# -*- encoding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 5
_modified_time = 1305079849.202123
_template_filename='/home/dcrowdy/src/arkaiv/trunk/arkaiv/templates/displayitem.mak'
_template_uri='/displayitem.mak'
_template_cache=cache.Cache(__name__, _modified_time)
_source_encoding='utf-8'
from webhelpers.html import escape
_exports = []


def _mako_get_namespace(context, name):
    try:
        return context.namespaces[(__name__, name)]
    except KeyError:
        _mako_generate_namespaces(context)
        return context.namespaces[(__name__, name)]
def _mako_generate_namespaces(context):
    pass
def _mako_inherit(template, context):
    _mako_generate_namespaces(context)
    return runtime._inherit_from(context, u'/autohandler', _template_uri)
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        h = context.get('h', UNDEFINED)
        c = context.get('c', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u' \n\n<!-- begin left content -->\n<div id="leftContent">\n\n')
        # SOURCE LINE 11
        __M_writer(u'<h3>')
        __M_writer(escape(c.itemname))
        __M_writer(u'</h3>\n')
        # SOURCE LINE 17
        __M_writer(u' \n<div id="video">\n')
        # SOURCE LINE 19
        if c.sourcedict['has_video'] == "Yes":
            # SOURCE LINE 20
            __M_writer(u"<video src='")
            __M_writer(escape(c.sourcedict['urlpath']))
            __M_writer(escape(c.sourcedict['clipdetail']))
            __M_writer(u'\' controls=\'controls\' ontimeupdate="Updatetime()" width=320 height=240></video>\n')
            pass
        # SOURCE LINE 22
        __M_writer(u'\n')
        # SOURCE LINE 23
        if c.sourcedict['has_video'] == "No":
            # SOURCE LINE 24
            __M_writer(u"<audio src='")
            __M_writer(escape(c.sourcedict['urlpath']))
            __M_writer(escape(c.sourcedict['clipdetail']))
            __M_writer(u'\' controls=\'controls\' ontimeupdate="Updatetime()"></audio>\n')
            pass
        # SOURCE LINE 26
        __M_writer(u'</div>\n\n\n<div class="sourceinfo">\n<table style="font-size:small">\n\t<tr>\n\t\t<td>Duration: </td><td>')
        # SOURCE LINE 32
        __M_writer(escape(c.sourcedict['duration']))
        __M_writer(u'</td>\n\t</tr>\n\t<tr>\n\t\t<td>Bitrate: </td><td>')
        # SOURCE LINE 35
        __M_writer(escape(c.sourcedict['bitrate']))
        __M_writer(u'</td>\n\t</tr>\n\t<tr>\n\t\t<td>Resolution: </td><td>')
        # SOURCE LINE 38
        __M_writer(escape(c.sourcedict['resolution']))
        __M_writer(u'</td>\n\t</tr>\n\t<tr>\n\t\t<td>Framerate: </td><td>')
        # SOURCE LINE 41
        __M_writer(escape(c.sourcedict['framerate']))
        __M_writer(u'</td>\n\t</tr>\n\t<tr>\n\t\t<td>Audio: </td><td>')
        # SOURCE LINE 44
        __M_writer(escape(c.sourcedict['audio']))
        __M_writer(u'</td>\n\t</tr>\n\t<tr>\n\t\t<td>Has video: </td><td>')
        # SOURCE LINE 47
        __M_writer(escape(c.sourcedict['has_video']))
        __M_writer(u'</td>\n\t</tr>\n\t<tr>\n\t\t<td>Has audio: </td><td>')
        # SOURCE LINE 50
        __M_writer(escape(c.sourcedict['has_audio']))
        __M_writer(u'</td>\n\t</tr>\n</table>\n</div>\n<div style="clear: both;"></div>\n\n\n<form name="api">\n\t<table>\n\t\t<tr>\n\t\t\t<td>Time:</td>\n\t\t\t<td><input name="tfield" size="6" /></td>\n\t\t\t<td>Go to:</td>\n\t\t\t<td><input name="gfield" size="6" onchange=\'Gototime("')
        # SOURCE LINE 63
        __M_writer(escape(c.sourcedict['urlpath']))
        __M_writer(u'?t=")\' /></td>\n\t\t</tr>\n')
        # SOURCE LINE 70
        __M_writer(u'\t</table>\n</form>\n\n\n')
        # SOURCE LINE 88
        __M_writer(u'\n\n<h4>Meta information:</h4>\n<table>\n\t<tr>\n\t\t<td>Name</td>\n\t\t<td>Content</td>\n\t</tr>\n')
        # SOURCE LINE 96
        i = 0 
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['i'] if __M_key in __M_locals_builtin_stored]))
        __M_writer(u'\n')
        # SOURCE LINE 97
        for metainfo in c.metalist:
            # SOURCE LINE 98
            __M_writer(u'\t<tr>\n\t\t<td><span id="editmetaname')
            # SOURCE LINE 99
            __M_writer(escape(i))
            __M_writer(u'">')
            __M_writer(escape(metainfo['name']))
            __M_writer(u'</span>\n\t\t<script type="text/javascript">\n\t\t new Ajax.InPlaceEditor(\'editmetaname')
            # SOURCE LINE 101
            __M_writer(escape(i))
            __M_writer(u"', '/item/editheadmetaname', { callback: function(form, value) { return 'id=")
            __M_writer(escape(metainfo['id']))
            __M_writer(u'&field=name&itemid=')
            __M_writer(escape(c.itemid))
            __M_writer(u'&myparam=\' + escape(value) }});\n\t\t</script>\n\t\t</td>\n\t\t<td>\n\t\t<span id="editmetacontent')
            # SOURCE LINE 105
            __M_writer(escape(i))
            __M_writer(u'">')
            __M_writer(escape(metainfo['content']))
            __M_writer(u'</span>\n\t\t<script type="text/javascript">\n\t\t new Ajax.InPlaceEditor(\'editmetacontent')
            # SOURCE LINE 107
            __M_writer(escape(i))
            __M_writer(u"', '/item/editheadmetaname', { callback: function(form, value) { return 'id=")
            __M_writer(escape(metainfo['id']))
            __M_writer(u'&field=content&itemid=')
            __M_writer(escape(c.itemid))
            __M_writer(u"&myparam=' + escape(value) }});\n\t\t</script>\n\t\t</td>\n\t\t<td>\n")
            # SOURCE LINE 117
            __M_writer(u'\t\t</td>\n\t</tr> \n')
            # SOURCE LINE 119
            i = i + 1 
            
            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['i'] if __M_key in __M_locals_builtin_stored]))
            __M_writer(u'\n')
            pass
        # SOURCE LINE 121
        __M_writer(u'</table>\n\n<hr />\n\n\n<h4>Add new meta tag:</h4>\n')
        # SOURCE LINE 127
        __M_writer(escape( h.form(h.url(controller='item', action='addmetainfo'), multipart=True) ))
        __M_writer(u'\n<table>\n\t<tr>\n\t\t<td>ID</td>\n\t\t<td>Name</td>\n\t\t<td>Content</td>\n\t</tr>\n\t<tr>\n\t\t<td>')
        # SOURCE LINE 135
        __M_writer(escape( h.text('metaid', size=5) ))
        __M_writer(u'</td>\n\t\t<td>')
        # SOURCE LINE 136
        __M_writer(escape( h.text('metaname') ))
        __M_writer(u'</td>\n\t\t<td>')
        # SOURCE LINE 137
        __M_writer(escape( h.text('metacontent') ))
        __M_writer(u'</td>\n\t</tr>\n</table>\n\n')
        # SOURCE LINE 141
        __M_writer(escape( h.hidden('metascheme') ))
        __M_writer(u'\n')
        # SOURCE LINE 142
        __M_writer(escape( h.hidden('headindex', value = c.headdict['index']) ))
        __M_writer(u'\n')
        # SOURCE LINE 143
        __M_writer(escape( h.hidden('itemid', value=c.itemid) ))
        __M_writer(u'\n\n')
        # SOURCE LINE 145
        __M_writer(escape( h.submit('add', 'Add') ))
        __M_writer(u' \n')
        # SOURCE LINE 146
        __M_writer(escape( h.end_form() ))
        __M_writer(u' \n\n<hr />\n</div>\n<!-- end left content -->\n\n\n<!-- begin right content -->\n<div id="clipContent">\n<h5>Clips</h5>\n<div id="clipBox">\n<table>\n\t<tr>\n\t\t<td></td>\n\t\t<td>Time</td>\n\t\t<td></td>\n\t\t<td></td> \n\t</tr>\n\t\n')
        # SOURCE LINE 165
        for clipinfo in c.cliplist:
            # SOURCE LINE 166
            __M_writer(u'\t<tr>\n')
            # SOURCE LINE 167
            if c.sourcedict['has_video'] == "Yes":
                # SOURCE LINE 168
                if clipinfo['end_time'] == 0:
                    # SOURCE LINE 169
                    __M_writer(u'\t\t<td><a onclick=\'ClipPlay("')
                    __M_writer(escape(c.sourcedict['urlpath']))
                    __M_writer(u'?t=')
                    __M_writer(escape(clipinfo['id']))
                    __M_writer(u'",')
                    __M_writer(escape(clipinfo['id']))
                    __M_writer(u')\'><img src="')
                    __M_writer(escape(c.sourcedict['clipimageurl']))
                    __M_writer(escape(clipinfo['img_src']))
                    __M_writer(u'"></a></td>\n')
                    # SOURCE LINE 170
                else:
                    # SOURCE LINE 171
                    __M_writer(u'\t\t<td><a onclick=\'ClipPlay("')
                    __M_writer(escape(c.sourcedict['urlpath']))
                    __M_writer(u'?t=')
                    __M_writer(escape(clipinfo['id']))
                    __M_writer(u'/')
                    __M_writer(escape(clipinfo['end_time']))
                    __M_writer(u'"),')
                    __M_writer(escape(clipinfo['id']))
                    __M_writer(u'\'><img src="')
                    __M_writer(escape(c.sourcedict['clipimageurl']))
                    __M_writer(escape(clipinfo['img_src']))
                    __M_writer(u'"></a></td>\n')
                    pass
                pass
            # SOURCE LINE 174
            __M_writer(u'\t\n')
            # SOURCE LINE 175
            if c.sourcedict['has_video'] == "No":
                # SOURCE LINE 176
                if clipinfo['end_time'] == 0:
                    # SOURCE LINE 177
                    __M_writer(u'\t\t<td><a onclick=\'ClipPlay("')
                    __M_writer(escape(c.sourcedict['urlpath']))
                    __M_writer(u'?t=')
                    __M_writer(escape(clipinfo['id']))
                    __M_writer(u'",')
                    __M_writer(escape(clipinfo['id']))
                    __M_writer(u')\'><img src="/images/blank.png"></a></td>\n')
                    # SOURCE LINE 178
                else:
                    # SOURCE LINE 179
                    __M_writer(u'\t\t<td><a onclick=\'ClipPlay("')
                    __M_writer(escape(c.sourcedict['urlpath']))
                    __M_writer(u'?t=')
                    __M_writer(escape(clipinfo['id']))
                    __M_writer(u'/')
                    __M_writer(escape(clipinfo['end_time']))
                    __M_writer(u'",')
                    __M_writer(escape(clipinfo['id']))
                    __M_writer(u')\'><img src="/images/blank.png"></a></td>\n')
                    pass
                pass
            # SOURCE LINE 182
            __M_writer(u'\t\n\t\t<td>')
            # SOURCE LINE 183
            __M_writer(escape(clipinfo['start_time']))
            __M_writer(u'</td>\n\t\t<td>')
            # SOURCE LINE 184
            __M_writer(escape(clipinfo['desc']))
            __M_writer(u'</td>\n\t\t<td>')
            # SOURCE LINE 185
            __M_writer(escape(clipinfo['a_href']))
            __M_writer(u'</td>\n\t\n')
            # SOURCE LINE 192
            __M_writer(u'\t\n\t</tr> \n')
            pass
        # SOURCE LINE 195
        __M_writer(u'</table>\n</div>\n</div>\n\n\n<div id="rightContent">\n<h5>Add new clip:</h5>\n<!--')
        # SOURCE LINE 202
        __M_writer(escape( h.form(h.url(controller='item', action='addclip'), multipart=True) ))
        __M_writer(u'-->\n<form name="addaclip" action="addclip" >\n<table style="font-size:small">\n\t<tr>\n\t\t<td>Start</td>\n\t\t<td>')
        # SOURCE LINE 207
        __M_writer(escape( h.text('starttime', size=5) ))
        __M_writer(u'</td>\n\t</tr>\n\t<tr>\n\t\t<td>End</td>\n\t\t<td>')
        # SOURCE LINE 211
        __M_writer(escape( h.text('endtime', size=5) ))
        __M_writer(u'</td>\n\t</tr>\n\t<tr>\n\t\t<td>Desc</td>\n\t\t<td><input type="text" name="desc" size="20" onfocus="disableShortcuts()" onblur="enableShortcuts()" id="desc" /><!--')
        # SOURCE LINE 215
        __M_writer(escape( h.text('desc') ))
        __M_writer(u'--></td>\n\t</tr>\n\t<tr>\n\t\t<td>a_text</td>\n\t\t<td>')
        # SOURCE LINE 219
        __M_writer(escape( h.text('a_text') ))
        __M_writer(u'</td>\n\t</tr>\n\t<tr>\n\t\t<td>a_href</td>\n\t\t<td>')
        # SOURCE LINE 223
        __M_writer(escape( h.text('a_href') ))
        __M_writer(u'</td>\n\t</tr>\n</table>\n')
        # SOURCE LINE 226
        __M_writer(escape( h.hidden('headindex', value = c.headdict['index']) ))
        __M_writer(u'\n')
        # SOURCE LINE 227
        __M_writer(escape( h.hidden('itemid', value=c.itemid) ))
        __M_writer(u'\n')
        # SOURCE LINE 228
        __M_writer(escape( h.hidden('hasvideo', value=c.sourcedict['has_video']) ))
        __M_writer(u'\n')
        # SOURCE LINE 229
        __M_writer(escape( h.submit('add', 'Add') ))
        __M_writer(u' \n')
        # SOURCE LINE 230
        __M_writer(escape( h.end_form() ))
        __M_writer(u' \n\n\n<script>\nvar output = document.api.ofield;\nvar toutput = document.api.tfield;\nvar gototime = document.api.gfield;\nvar myVideo = document.getElementsByTagName(\'video\')[0];\nvar myAudio = document.getElementsByTagName(\'audio\')[0];\n\nvar startpointinstream = 0;\n\nif (myAudio) {\n//  addOutput("Audio");\n  myMedia = myAudio;\n}\nelse {\n//  addOutput("Video");\n  myMedia = myVideo;\n}\n\nv.addEventListener("seeked", function() { document.getElementsByTagName("video")[0].play(); }, true);\n\nfunction ClipPlay(location,pointinstream) {\n  myMedia.src = location\n  myMedia.load();\n  myMedia.play();\n  startpointinstream = pointinstream;\n  //addOutput("Audio clip");\n}\n\nfunction Updatetime() {\n  addToutput(myMedia.currentTime + startpointinstream);\n}\n\nfunction addToutput(str) {\n  toutput.value = str;\n}\n\nfunction Gototime(location) {\n  t = getGoto();\n//  addOutput(location + t);\n  myMedia.src = location + t;\n  myMedia.load();\n  myMedia.play();\n  startpointinstream = t;\n}\n\nfunction getGoto() {\n  i = parseInt(gototime.value);\n  return isNaN(i) ? 0 : i;\n}\n\nvar outLines = 0;\n\nfunction addOutput(str) {\n  if (outLines == 0) {\n    output.value = str;\n  } else {\n    output.value = str + "\\n" + output.value;\n  }\n  outLines++;\n  if (outLines == 11) {\n    i = output.value.lastIndexOf("\\n");\n    output.value = output.value.substr(0, i);\n    outLines--;\n  }\n\n}\n</script>\n\n</div>\n<!-- end right content -->\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


